home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / UTIL / Alpha 6.5.sit / Tcl / Modes / latexMenu.tcl < prev    next >
Text File  |  1996-08-15  |  26KB  |  1,233 lines

  1. #############################################################################
  2. #############################################################################
  3. #
  4. # latexMenu.tcl (called from latex.tcl)
  5. #
  6. # LaTeX menu definitions and key bindings
  7. #
  8. #############################################################################
  9. #
  10. # Author:  Tom Scavo <trscavo@syr.edu>
  11. #
  12. #############################################################################
  13. #############################################################################
  14.  
  15. # The highest level menu macro, to be called initially or whenever 
  16. # the LaTeX menu must be rebuilt (as in 'shadowtexSig' in latex.tcl,
  17. # or 'toggleLaTeXMenus' below):
  18. proc buildLaTeXMenu {} {
  19.     global texSig texAppSig latexMenu
  20.     global useShortLaTeXMenu
  21.     global modifiedModeMenus
  22.     
  23.     set texAppMenuID(OzTeX) "・266"
  24.     set texAppMenuID(Textures) "・267"
  25.     set texAppMenuID(CMacTeX) "・272"
  26. #     set texAppMenuID(CMacTeX) "・273"
  27.     set texAppMenuID(DirectTeXPro) "・299"
  28.     if { [info exists texSig] && $texSig != "" } {
  29.         set supportedApps [array names texAppMenuID]
  30.         foreach app $supportedApps {
  31.             if { $texAppSig($app) == $texSig } {
  32.                 set latexMenu $texAppMenuID($app)
  33.                 break
  34.             }
  35.         }
  36.     }
  37.     menu -M TeX -n $latexMenu -m [getLaTeXMenu]
  38.     markMenuItem {LaTeX Utilities} {Short LaTeX Menu} $useShortLaTeXMenu
  39.     lappend modifiedModeMenus TeX
  40.     return
  41. }
  42.  
  43. # Invoked by choosing "Short LaTeX Menu" on the "LaTeX Utilities" submenu:
  44. proc toggleLaTeXMenus {} {
  45.     global useShortLaTeXMenu modifiedVars
  46.     watchCursor
  47.     set useShortLaTeXMenu [expr 1 - $useShortLaTeXMenu]
  48.     lappend modifiedVars useShortLaTeXMenu
  49.     message {Rebuilding LaTeX menuノ}
  50.     buildLaTeXMenu
  51.     message ""
  52. }
  53.  
  54. # Return a short menu or a long menu, depending on the value of
  55. # the global variable 'useShortLaTeXMenu':
  56. proc getLaTeXMenu {} {
  57.     global useShortLaTeXMenu
  58.     if {$useShortLaTeXMenu} {
  59.         return [concat ¥
  60.             [getLaTeXCommands] ¥
  61.           {{(-}} ¥
  62.           [getTextSubsubmenus] ¥
  63.           {{(-}} ¥
  64.           [getMathSubsubmenus] ¥
  65.         ]
  66.     } else {
  67.         return [concat ¥
  68.             [getLaTeXCommands] ¥
  69.           {{(-}} ¥
  70.             [getTextSubmenus] ¥
  71.             {{(-}} ¥
  72.             [getMathSubmenus] ¥
  73.         ]
  74.     }
  75. }
  76.  
  77. # Return generic LaTeX commands common to both menus:
  78. proc getLaTeXCommands {} {
  79.     return [list ¥
  80.         [typesetSubmenu] ¥
  81.         [gotoSubmenu] ¥
  82.         [latexUtilitiesSubmenu] ¥
  83.         "LaTeX Palette" ¥
  84.         {(-} ¥
  85.         [documentsSubmenu] ¥
  86.         [pageLayoutSubmenu] ¥
  87.         [sectioningSubmenu] ¥
  88.     ]
  89. }
  90.  
  91. proc laTeXPalette {} {
  92.     global latexMenu
  93.     float -m $latexMenu -n LaTeX -M -1 -z TeX
  94. }
  95.  
  96. # Return the text submenus as a hierarchical submenu (for the short menu):
  97. proc getTextSubsubmenus {} {
  98.     set m [getTextSubmenus]
  99.     set mm [list menu -M TeX -n {Text Submenus} -m $m]
  100.     return [list $mm]
  101. }
  102.  
  103. # Return the math submenus as a hierarchical submenu (for the short menu):
  104. proc getMathSubsubmenus {} {
  105.     set m [getMathSubmenus]
  106.     set mm [list menu -M TeX -n {Math Submenus} -m $m]
  107.     return [list $mm]
  108. }
  109.  
  110. # Return the text submenus:
  111. proc getTextSubmenus {} {
  112.     return [list ¥
  113.         [textStyleSubmenu] ¥
  114.       [textSizeSubmenu] ¥
  115.       [internationalSubmenu] ¥
  116.       [environmentsSubmenu] ¥
  117.       [boxesSubmenu] ¥
  118.       [miscellaneousSubmenu] ¥
  119.     ]
  120. }
  121.  
  122. # Return the math submenus:
  123. proc getMathSubmenus {} {
  124.     return [list ¥
  125.         [mathModeSubmenu] ¥
  126.       [mathStyleSubmenu] ¥
  127.       [mathEnvironmentsSubmenu] ¥
  128.       [formulasSubmenu] ¥
  129.       [greekSubmenu] ¥
  130.       [binaryOperatorsSubmenu] ¥
  131.       [relationsSubmenu] ¥
  132.       [arrowsSubmenu] ¥
  133.       [dotsSubmenu] ¥
  134.       [symbolsSubmenu] ¥
  135.       [functionsSubmenu] ¥
  136.       [largeOperatorsSubmenu] ¥
  137.       [delimitersSubmenu] ¥
  138.       [mathAccentsSubmenu] ¥
  139.       [groupingSubmenu] ¥
  140.       [spacingSubmenu] ¥
  141.     ]
  142. }
  143.  
  144. #############################################################################
  145. #
  146. # Submenu definitions
  147. #
  148. #############################################################################
  149.  
  150. # Return the "Typeset" submenu.  If the current document belongs
  151. # to a TeX fileset, display the base filename throughout.
  152. #
  153. proc typesetSubmenu {} {
  154.     set currentWin [lindex [winNames -f] 0]
  155.     if { $currentWin == "" } {
  156.         return [minimalTypesetSubmenu]
  157.     } else {
  158.         set currentDoc [file tail $currentWin]
  159.         # Process an untitled window:
  160.         if { [set num [winUntitled]] } {
  161.             if { $num > 1 } { set currentDoc "Untitled$num" }
  162.             # fall through
  163.         } else {
  164.             set ext [file extension $currentWin]
  165.             if { [lsearch -exact {.tex .ltx .dtx .ins} $ext] < 0 } {
  166.                 return [minimalTypesetSubmenu]
  167.             }
  168.         }
  169.     }
  170.     set docBasename [file rootname $currentDoc]
  171.     set projBasename $docBasename
  172.     set currentProj [isWindowInFileset $currentWin "tex"]
  173.     if {    $currentProj !=    "" } {
  174.         set currentDoc [file tail [texFilesetBaseName $currentProj]]
  175.         set docBasename [file rootname $currentDoc]
  176.     }
  177.     # Determine which menu items are dimmed:
  178.     foreach ext {DVI PS AUX IDX Selection} { set prefix$ext "" }
  179. #     if { [findAuxiliaryFile DVI] == "" } {
  180. #         set prefixDVI "("
  181. #     }
  182. #     if { [findAuxiliaryFile PS] == "" } {
  183. #         set prefixPS "("
  184. #     }
  185. #     if { [findAuxiliaryFile AUX] == "" } {
  186. #         set prefixAUX "("
  187. #     }
  188. #     if { [findAuxiliaryFile IDX] == "" } {
  189. #         set prefixIDX "("
  190. #     }
  191. #     if { ![isSelection] } {
  192. #         set prefixSelection "("
  193. #     }
  194.     return [list menu -M TeX -n Typeset -m -p typesetSubmenuFilter [list ¥
  195.         [list /TTypeset $currentDoc] ¥
  196.         [list <U<O/V${prefixDVI}View "$docBasename¥.dvi"] ¥
  197.         [list <U<O/P${prefixDVI}Print "$docBasename¥.dvi"] ¥
  198.         "(-" ¥
  199.         {<U<O/TTypeset Clipboard} ¥
  200.         [list ${prefixSelection}Typeset Selection] ¥
  201.         "(-" ¥
  202.         [list <S${prefixPS}Open "$docBasename¥.ps"] ¥
  203.         [list <S${prefixDVI}dvips "$docBasename¥.dvi"] ¥
  204.         [list ${prefixPS}View "$docBasename¥.ps"] ¥
  205.         [list ${prefixPS}Print "$docBasename¥.ps"] ¥
  206.         "(-" ¥
  207.         [list <SOpen "$docBasename¥.bbl"] ¥
  208.         [list <S${prefixAUX}bibtex "$docBasename¥.aux"] ¥
  209.         [list <E<SOpen "$docBasename¥.ind"] ¥
  210.         [list <S${prefixIDX}makeindex "$docBasename¥.idx"] ¥
  211.         "(-" ¥
  212.         [typesetOtherFilesSubmenu $docBasename $projBasename] ¥
  213.         "(-" ¥
  214.         {Remove Auxiliary Filesノ} ¥
  215.         {Remove Temporary Files} ¥
  216.         ]
  217.     ]
  218. }
  219.  
  220. proc minimalTypesetSubmenu {} {
  221.     return [list menu -M TeX -n Typeset -m -p typesetSubmenuFilter [list ¥
  222.         [list /TTypesetノ] ¥
  223.         "(-" ¥
  224.         {<U<O/TTypeset Clipboard} ¥
  225.         {Typeset Selection} ¥
  226.         ]
  227.     ]
  228. }
  229.  
  230. # Return a submenu of LaTeX auxiliary files with basename $basename1,
  231. # except for the .aux file whose primary basename is $basename2.
  232. #
  233. proc typesetOtherFilesSubmenu { basename1 basename2 } {
  234.     return [list menu -M TeX -n {Other Files} -m -p typesetSubmenuFilter [list ¥
  235.         [list Open "$basename1¥.log"] ¥
  236.         [concat <SOpen "$basename1¥.aux "] ¥
  237.         [concat <SOpen "$basename2¥.aux"] ¥
  238.         [list Open "$basename1¥.toc"] ¥
  239.         [list Open "$basename1¥.lof"] ¥
  240.         [list Open "$basename1¥.lot"] ¥
  241.         [list Open "$basename1¥.idx"] ¥
  242.         "(-" ¥
  243.         [list Open "$basename1¥.blg"] ¥
  244.         [list Open "$basename1¥.ilg"] ¥
  245.         "(-" ¥
  246.         {<U<O/OOpen Any TeX Fileノ} ¥
  247.         ]
  248.     ]
  249. }
  250.  
  251. proc typesetSubmenuFilter {submenu item} {
  252.     switch -regexp $item {
  253.         {Typeset Selection}  {set func "typesetSelection"}
  254.         {Typeset Clipboard}  {set func "typesetClipboard"}
  255.         "Typeset.*"  {set func "typeset"}
  256.         "View.*¥.dvi$"  {set func {doTypesetCommand view DVI}}
  257.         "Print.*¥.dvi$"  {set func {doTypesetCommand print DVI}}
  258.         "dvips.*¥.dvi$"  {set func {doTypesetCommand dvips DVI}}
  259.         "View.*¥.ps$"  {set func {doTypesetCommand view PS}}
  260.         "Print.*¥.ps$"  {set func {doTypesetCommand print PS}}
  261.         "bibtex.*"  {set func {doTypesetCommand bibtex AUX}}
  262.         "makeindex.*"  {set func {doTypesetCommand makeindex IDX}}
  263.         "Open.*¥.ps$"  {set func {doTypesetCommand open PS}}
  264.         "Open.*¥.bbl$"  {set func {doTypesetCommand open BBL}}
  265.         "Open.*¥.ind$"  {set func {doTypesetCommand open IND}}
  266.         "Open.*¥.log$"  {set func {doTypesetCommand open LOG}}
  267.         "Open.*¥.aux$"  {set func {doTypesetCommand open AUX 1}}
  268.         "Open.*¥.aux $"  {set func {doTypesetCommand open AUX}}
  269.         "Open.*¥.toc$"  {set func {doTypesetCommand open TOC}}
  270.         "Open.*¥.lof$"  {set func {doTypesetCommand open LOF}}
  271.         "Open.*¥.lot$"  {set func {doTypesetCommand open LOT}}
  272.         "Open.*¥.idx$"  {set func {doTypesetCommand open IDX}}
  273.         "Open.*¥.blg$"  {set func {doTypesetCommand open BLG}}
  274.         "Open.*¥.ilg$"  {set func {doTypesetCommand open ILG}}
  275.         {Open Any TeX File}  {set func "openAnyTeXFile"}
  276.         {Remove Auxiliary Files}  {set func "removeAuxiliaryFiles"}
  277.         {Remove Temporary Files}  {set func "removeTemporaryFiles"}
  278.         default {set func $item}
  279.     }
  280.     eval $func
  281. }
  282.  
  283. # Return the "Goto" submenu:
  284. proc gotoSubmenu {} {
  285.     return {menu -M TeX -n Goto -m -p gotoSubmenuFilter {
  286.         "<U/SLaTeX"
  287.         "BibTeX"
  288.         "MakeIndex"
  289.         "(-"
  290.         {/cNext Tab Stop}
  291.         {<U/cPrev Tab Stop}
  292.         {<B/cnth Tab Stopノ}
  293.         "(-"
  294.         {Next Command}
  295.         {Prev Command}
  296.         {Next Command Select}
  297.         {Prev Command Select}
  298.         {Next Command Select With Args}
  299.         {Prev Command Select With Args}
  300.         "(-"
  301.         {Next Environment}
  302.         {Prev Environment}
  303.         {Next Environment Select}
  304.         {Prev Environment Select}
  305.         "(-"
  306.         {Next Section}
  307.         {Prev Section}
  308.         {Next Section Select}
  309.         {Prev Section Select}
  310.         {Next Subsection}
  311.         {Prev Subsection}
  312.         {Next Subsection Select}
  313.         {Prev Subsection Select}
  314.         }
  315.     }
  316. }
  317.  
  318. proc gotoSubmenuFilter {submenu item} {
  319.     switch $item {
  320.         "LaTeX"  {set func "latex"}
  321.         "BibTeX"  {set func "bibtex"}
  322.         "MakeIndex"  {set func "makeindex"}
  323.         {Next Tab Stop}  {set func "nextTabStop"}
  324.         {Prev Tab Stop}  {set func "prevTabStop"}
  325.         {nth Tab Stop}  {set func "nthTabStop"}
  326.         {Next Command}  {set func "nextCommand"}
  327.         {Prev Command}  {set func "prevCommand"}
  328.         {Next Command Select}  {set func "nextCommandSelect"}
  329.         {Prev Command Select}  {set func "prevCommandSelect"}
  330.         {Next Command Select With Args}  {set func "nextCommandSelectWithArgs"}
  331.         {Prev Command Select With Args}  {set func "prevCommandSelectWithArgs"}
  332.         {Next Environment}  {set func "nextEnvironment"}
  333.         {Prev Environment}  {set func "prevEnvironment"}
  334.         {Next Environment Select}  {set func "nextEnvironmentSelect"}
  335.         {Prev Environment Select}  {set func "prevEnvironmentSelect"}
  336.         {Next Section}  {set func "nextSection"}
  337.         {Prev Section}  {set func "prevSection"}
  338.         {Next Section Select}  {set func "nextSectionSelect"}
  339.         {Prev Section Select}  {set func "prevSectionSelect"}
  340.         {Next Subsection}  {set func "nextSubsection"}
  341.         {Prev Subsection}  {set func "prevSubsection"}
  342.         {Next Subsection Select}  {set func "nextSubsectionSelect"}
  343.         {Prev Subsection Select}  {set func "prevSubsectionSelect"}
  344.         default {set func $item}
  345.     }
  346.     eval $func
  347. }
  348.  
  349. # Return the "LaTeX Utilities" submenu:
  350. proc latexUtilitiesSubmenu {} {
  351.     return {menu -M TeX -n {LaTeX Utilities} -m -p latexUtilsSubmenuFilter {
  352.         {<U<O/CChoose Commandノ}
  353.         "(-"
  354.         {<I/cInsert Literal Tab}
  355.         {Insert Tab Stop}
  356.         "(-"
  357.         {<O/cDelete Tab Stops}
  358.         {Delete Comments}
  359.         "(-"
  360.         {Convert Quotes}
  361.         {Convert Dollar Signs}
  362.         "(-"
  363.         {Short LaTeX Menu}
  364.         }
  365.     }
  366. }
  367.  
  368. proc latexUtilsSubmenuFilter {submenu item} {
  369.     switch $item {
  370.         {Choose Command}  {set func {chooseCommand [getLaTeXMenu]}}
  371.         {Insert Literal Tab}  {set func "insertLiteralTab"}
  372.         {Insert Tab Stop}  {set func "insertTabStop"}
  373.         {Insert Reference}  {set func "insertReference"}
  374.         {Delete Tab Stops}  {set func "deleteTabStops"}
  375.         {Delete Comments}  {set func "deleteComments"}
  376.         {Convert Quotes}  {set func "convertQuotes"}
  377.         {Convert Dollar Signs}  {set func "convertDollarSigns"}
  378.         {Short LaTeX Menu}  {set func "toggleLaTeXMenus"}
  379.         default {set func $item}
  380.     }
  381.     eval $func
  382. }
  383.  
  384. # Return the "Documents" submenu:
  385. proc documentsSubmenu {} {
  386.     return [list menu -M TeX -n Documents -m -p documentsSubmenuFilter [list ¥
  387.         {<U<O/NNew Documentノ} ¥
  388.         [insertDocumentSubmenu] ¥
  389.         "(-" ¥
  390.         "optionsノ" ¥
  391.         "<B<I/Uusepackage" ¥
  392.         [packagesSubmenu] ¥
  393.         "(-" ¥
  394.         "filecontentsノ" ¥
  395.         {filecontents All} ¥
  396.         "(-" ¥
  397.         {Rebuild Documents Submenu} ¥
  398.         ]
  399.     ]
  400. }
  401.  
  402. proc insertDocumentSubmenu {} {
  403.     return {menu -M TeX -n {Insert Document} -m -p documentsSubmenuFilter {
  404.         "article"
  405.         "report"
  406.         "book"
  407.         "letter"
  408.         "slides"
  409.         "otherノ"
  410.         }
  411.     }
  412. }
  413.  
  414. proc documentsSubmenuFilter {submenu item} {
  415.     switch $item {
  416.         {New Document}  {set func "newLaTeXDocument"}
  417.         {article}  {set func "articleDocumentclass"}
  418.         {report}  {set func "reportDocumentclass"}
  419.         {book}  {set func "bookDocumentclass"}
  420.         {letter}  {set func "letterDocumentclass"}
  421.         {slides}  {set func "slidesDocumentclass"}
  422.         {other}  {set func "otherDocumentclass"}
  423.         {usepackage} {insertPackage ""; return}
  424.         {filecontents All} {set func "filecontentsAll"}
  425.         {Rebuild Documents Submenu}  {
  426.             global packagesSubmenuItems
  427.             set packagesSubmenuItems ""
  428.             message "Rebuilding the Documents submenuノ"
  429.             eval [documentsSubmenu]
  430.             message ""
  431.             return
  432.         }
  433.         default {set func $item}
  434.     }
  435.     eval $func
  436. }
  437.  
  438. proc packagesSubmenu {} {
  439.     global TeXmodeVars
  440.     if { $TeXmodeVars(buildPkgsSubmenu) } {
  441.         global packagesSubmenuItems
  442.         if { ![info exists packagesSubmenuItems] || $packagesSubmenuItems == "" } {
  443.                 global latexPackages
  444.                 set folders [buildTeXSearchPath 0]
  445.                 # See DblClickAux.tcl for the definition of 'buildSubMenu':
  446.                 set packagesSubmenuItems ¥
  447.                     [buildSubMenu $folders "Packages" packageFilter latexPackages ".sty"]
  448.         }
  449.         return $packagesSubmenuItems
  450.     } else {
  451. #         if { [info exists packagesSubmenuItems] } {
  452.         catch {unset packagesSubmenuItems}
  453. #         }
  454.         return ""
  455.     }
  456. }
  457.  
  458. proc packageFilter {submenu pkgName} {
  459.     global latexPackages
  460.     # See latexMacros.tcl for definition of 'insertPackage':
  461.     insertPackage [file tail [file rootname $latexPackages($submenu:$pkgName)]]
  462. }
  463.  
  464. # Return the "Page Layout" submenu:
  465. proc pageLayoutSubmenu {} {
  466.     return {menu -M TeX -n {Page Layout} -m {
  467.         "maketitle"
  468.         "(-"
  469.         "abstract"
  470.         "titlepage"
  471.         "(-"
  472.         "pagestyleノ"
  473.         "thispagestyleノ"
  474.         "pagenumberingノ"
  475.         "(-"
  476.         "twocolumn"
  477.         "onecolumn"
  478.         }
  479.     }
  480. }
  481.  
  482. # Return the "Sectioning" submenu:
  483. proc sectioningSubmenu {} {
  484.     return {menu -M TeX -n Sectioning -m {
  485.         "part"
  486.         "chapter"
  487.         "section"
  488.         "subsection"
  489.         "subsubsection"
  490.         "paragraph"
  491.         "subparagraph"
  492.         "(-"
  493.         "appendix"
  494.         }
  495.     }
  496. }
  497.  
  498. # Return the "Text Style" submenu:
  499. proc textStyleSubmenu {} {
  500.     return {menu -M TeX -n {Text Style} -m {
  501.         "<S<B<I/Eemph"
  502.         "<S<U<B<I/Eem"
  503.         "<B<O/Uunderline"
  504.         "(-"
  505.         "<Supshape"
  506.         "<Stextup"
  507.         "<E<S<B<I/Itextit"
  508.         "<S<U<B<I/Iitshape"
  509.         "<E<S<B<I/Stextsl"
  510.         "<S<U<B<I/Sslshape"
  511.         "<E<S<B<I/Htextsc"
  512.         "<S<U<B<I/Hscshape"
  513.         "(-"
  514.         "<Smdseries"
  515.         "<Stextmd"
  516.         "<E<S<B<I/Btextbf"
  517.         "<S<U<B<I/Bbfseries"
  518.         "(-"
  519.         "<S<B<I/Rtextrm"
  520.         "<S<U<B<I/Rrmfamily"
  521.         "<E<S<B<I/Wtextsf"
  522.         "<S<U<B<I/Wsffamily"
  523.         "<E<S<B<I/Ytexttt"
  524.         "<S<U<B<I/Yttfamily"
  525.         "(-"
  526.         "<Snormalfont"
  527.         "<Stextnormal"
  528.         }
  529.     }
  530. }
  531.  
  532. # Return the "Text Size" submenu:
  533. proc textSizeSubmenu {} {
  534.     return {menu -M TeX -n {Text Size} -m {
  535.         "<B<I/1tiny"
  536.         "<B<I/2scriptsize"
  537.         "<B<I/3footnotesize"
  538.         "<B<I/4small"
  539.         "<B<I/5normalsize"
  540.         "<B<I/6large"
  541.         "<B<I/7Large"
  542.         "<B<I/8LARGE"
  543.         "<B<I/9huge"
  544.         "<B<I/0Huge"
  545.         }
  546.     }
  547. }
  548.  
  549. # Return the "International" submenu:
  550. proc internationalSubmenu {} {
  551.     return {menu -M TeX -n International -m {
  552.         {˜}
  553.         {抑
  554.         {凩
  555.         {嘲
  556.         {孺
  557.         "(-"
  558.         {閤
  559.         {マ}
  560.         {セ}
  561.         {迎
  562.         {ソ}
  563.         "(-"
  564.         {‚}
  565.         {ホ}
  566.         {ョ}
  567.         {±
  568.         {ッ}
  569.         "(-"
  570.         {ァ}
  571.         {チ}
  572.         {タ}
  573.         }
  574.     }
  575. }
  576.  
  577. # Return the "Environments" submenu:
  578. proc environmentsSubmenu {} {
  579.     return {menu -M TeX -n Environments -m {
  580.         "<I/kitemizeノ"
  581.         "<U<I/kenumerateノ"
  582.         "<B<I/kdescriptionノ"
  583.         "thebibliographyノ"
  584.         "(-"
  585.         "<I/lslide"
  586.         "<U<I/loverlay"
  587.         "<B<I/lnote"
  588.         "(-"
  589.         "<I/mfigure"
  590.         "<U<I/mtable"
  591.         "<B<I/mtabularノ"
  592.         "(-"
  593.         "<I/nverbatim"
  594.         "<U<I/nquote"
  595.         "<B<I/nquotation"
  596.         "verse"
  597.         "(-"
  598.         "<I/ocenter"
  599.         "<U<I/oflushleft"
  600.         "<B<I/oflushright"
  601.         "(-"
  602.         "<I/pgeneralノ"
  603.         }
  604.     }
  605. }
  606.  
  607. # Return the "Boxes" submenu:
  608. proc boxesSubmenu {} {
  609.     return {menu -M TeX -n Boxes -m {
  610.         "<B<I/Mmbox"
  611.         "makebox"
  612.         "fbox"
  613.         "framebox"
  614.         "(-"
  615.         "newsavebox"
  616.         "sbox"
  617.         "savebox"
  618.         "usebox"
  619.         "(-"
  620.         "raisebox"
  621.         "(-"
  622.         "parbox"
  623.         "minipage"
  624.         "(-"
  625.         "rule"
  626.         }
  627.     }
  628. }
  629.  
  630. # Return the "Miscellaneous" submenu:
  631. proc miscellaneousSubmenu {} {
  632.     return {menu -M TeX -n Miscellaneous -m -p miscSubmenuFilter {
  633.         "<B<I/Vverb"
  634.         "<B<I/Ffootnote"
  635.         {<B<I/Nmarginal note}
  636.         "(-"
  637.         "<B<I/Llabel"
  638.         "<B<I/Xref"
  639.         "<B<I/Ppageref"
  640.         "<B<I/Ccite"
  641.         "<U<B<I/Cnocite"
  642.         "(-"
  643.         "<B<I/Jitem"
  644.         "(-"
  645.         "<B<I/'quotes"
  646.         {<U<B<I/'double quotes}
  647.         "(-"
  648.         "!ノellipsis"
  649.         "!ミen-dash"
  650.         "!ムem-dash"
  651.         {TeX logo}
  652.         {LaTeX logo}
  653.         {LaTeX2e logo}
  654.         "date"
  655.         "(-"
  656.         "! dag"
  657.         "ddag"
  658.         {!、section mark}
  659.         {!ヲparagraph mark}
  660.         "!ゥcopyright"
  661.         "!」pounds"
  662.         }
  663.     }
  664. }
  665.  
  666. proc miscSubmenuFilter {submenu item} {
  667.     switch $item {
  668.         {marginal note}  {set func "marginalNote"}
  669.         "item" {set func "insertItem"}
  670.         {double quotes}  {set func "dblQuotes"}
  671.         "ellipsis"  {set func "ldots"}
  672.         {TeX logo}  {set func "texLogo"}
  673.         {LaTeX logo}  {set func "latexLogo"}
  674.         {LaTeX2e logo}  {set func "latex2eLogo"}
  675.         "date" {set func "today"}
  676.         {section mark}  {set func "sectionMark"}
  677.         {paragraph mark}  {set func "paragraphMark"}
  678.         default {set func $item}
  679.     }
  680.     eval $func
  681. }
  682.  
  683. # Return a "Math Modes" submenu (called below and in latexKeys.tcl):
  684. proc mathModeSubmenu {} {
  685.     global TeXmodeVars
  686.     if {$TeXmodeVars(useDollarSigns)} then {
  687.         bind '4' <zc> texMath "TeX"
  688.         bind '4' <zoc> texDisplaymath "TeX"
  689.         return {menu -M TeX -n {Math Modes} -m -p mathModeSubmenuFilter {
  690.             {<B<O/MTeX math}
  691.             {<B<I<O/MTeX displaymath}
  692.             "(-"
  693.             {LaTeX math}
  694.             {LaTeX displaymath}
  695.             }
  696.         }
  697.     } else {
  698.         bind '4' <zc> latexMath "TeX"
  699.         bind '4' <zoc> latexDisplaymath "TeX"
  700.         return {menu -M TeX -n {Math Modes} -m -p mathModeSubmenuFilter {
  701.             {TeX math}
  702.             {TeX displaymath}
  703.             "(-"
  704.             {<B<O/MLaTeX math}
  705.             {<B<I<O/MLaTeX displaymath}
  706.             }
  707.         }
  708.     }
  709. }
  710.  
  711. proc mathModeSubmenuFilter {submenu item} {
  712.     switch $item {
  713.         {TeX math}  {set func "texMath"}
  714.         {TeX displaymath}  {set func "texDisplaymath"}
  715.         {LaTeX math}  {set func "latexMath"}
  716.         {LaTeX displaymath}  {set func "latexDisplaymath"}
  717.         default {set func $item}
  718.     }
  719.     eval $func
  720. }
  721.  
  722. # Return the "Math Style" submenu:
  723. proc mathStyleSubmenu {} {
  724.     return {menu -M TeX -n {Math Style} -m {
  725.         "<B<I<O/Imathit"
  726.         "<B<I<O/Rmathrm"
  727.         "<B<I<O/Bmathbf"
  728.         "<B<I<O/Wmathsf"
  729.         "<B<I<O/Ymathtt"
  730.         "<B<I<O/Cmathcal"
  731.         "(-"
  732.         "<B<I<O/Ddisplaystyle"
  733.         "<B<I<O/Ttextstyle"
  734.         "<B<I<O/Sscriptstyle"
  735.         "scriptscriptstyle"
  736.         }
  737.     }
  738. }
  739.  
  740. # Return the "Math Environments" submenu:
  741. proc mathEnvironmentsSubmenu {} {
  742.     return {menu -M TeX -n {Math Environments} -m -p mathEnvsSubmenuFilter {
  743.         "<I/imath"
  744.         "(-"
  745.         "<U<I/idisplaymath"
  746.         "<B<I/iequation"
  747.         "(-"
  748.         "<U<I/jeqnarray*ノ"
  749.         "<B<I/jeqnarrayノ"
  750.         "(-"
  751.         "<I/jarrayノ"
  752.         "(-"
  753.         "<I/pgeneralノ"
  754.         }
  755.     }
  756. }
  757.  
  758. proc mathEnvsSubmenuFilter {submenu item} {
  759.     switch $item {
  760.         "array"  {set func "myArray"}
  761.         "eqnarray¥*"  {set func "eqnarrayStar"}
  762.         default {set func $item}
  763.     }
  764.     eval $func
  765. }
  766.  
  767. # Return the "Formulas" submenu:
  768. proc formulasSubmenu {} {
  769.     return {menu -M TeX -n Formulas -m -p formulasSubmenuFilter {
  770.         "subscript"
  771.         "superscript"
  772.         "(-"
  773.         "<B<O/Ffrac"
  774.         {<B<O/Rsqrt}
  775.         {nth root}
  776.         "(-"
  777.         {<B<O/1one parameterノ}
  778.         {<B<O/2two parametersノ}
  779.         }
  780.     }
  781. }
  782.  
  783. proc formulasSubmenuFilter {submenu item} {
  784.     switch $item {
  785.         {frac}  {set func "fraction"}
  786.         {sqrt}  {set func "squareRoot"}
  787.         {nth root}  {set func "nthRoot"}
  788.         {one parameter}  {set func "oneParameter"}
  789.         {two parameters}  {set func "twoParameters"}
  790.         default {set func $item}
  791.     }
  792.     eval $func
  793. }
  794.  
  795. # Return the "Greek" submenu:
  796. proc greekSubmenu {} {
  797.     return {menu -M TeX -n Greek -m {
  798.         "alpha"
  799.         "beta"
  800.         "<SGamma"
  801.         "<Sgamma"
  802.         "<E<SDelta"
  803.         "<Sdelta"
  804.         "epsilon"
  805.         "zeta"
  806.         "eta"
  807.         "<STheta"
  808.         "<Stheta"
  809.         "iota"
  810.         "kappa"
  811.         "<SLambda"
  812.         "<Slambda"
  813.         "mu"
  814.         "nu"
  815.         "<SXi"
  816.         "<Sxi"
  817.         "omicron"
  818.         "<SPi"
  819.         "<Spi"
  820.         "rho"
  821.         "<SSigma"
  822.         "<Ssigma"
  823.         "tau"
  824.         "<SUpsilon"
  825.         "<Supsilon"
  826.         "<E<SPhi"
  827.         "<Sphi"
  828.         "chi"
  829.         "<SPsi"
  830.         "<Spsi"
  831.         "<E<SOmega"
  832.         "<Somega"
  833.         "(-"
  834.         "varepsilon"
  835.         "vartheta"
  836.         "varpi"
  837.         "varrho"
  838.         "varsigma"
  839.         "varphi"
  840.         }
  841.     }
  842. }
  843.  
  844. # Return the "Binary Operators" submenu:
  845. proc binaryOperatorsSubmenu {} {
  846.     return {menu -M TeX -n {Binary Operators} -m {
  847.         "!アpm"
  848.         "mp"
  849.         "times"
  850.         "!ヨdiv"
  851.         "ast"
  852.         "star"
  853.         "circ"
  854.         "bullet"
  855.         "cdot"
  856.         "cap"
  857.         "cup"
  858.         "uplus"
  859.         "sqcap"
  860.         "sqcup"
  861.         "vee"
  862.         "wedge"
  863.         "setminus"
  864.         "(-"
  865.         "diamond"
  866.         "bigtriangleup"
  867.         "bigtriangledown"
  868.         "triangleleft"
  869.         "triangleright"
  870.         "lhd"
  871.         "rhd"
  872.         "unlhd"
  873.         "unrhd"
  874.         "(-"
  875.         "oplus"
  876.         "ominus"
  877.         "otimes"
  878.         "oslash"
  879.         "odot"
  880.         "(-"
  881.         "bigcirc"
  882.         "dagger"
  883.         "ddagger"
  884.         "amalg"
  885.         "wr"
  886.         }
  887.     }
  888. }
  889.  
  890. # Return the "Relations" submenu:
  891. proc relationsSubmenu {} {
  892.     return {menu -M TeX -n Relations -m -p relationsSubmenuFilter {
  893.         "<S!ウgeq"
  894.         "<S!イleq"
  895.         "<E<Ssucc"
  896.         "<Sprec"
  897.         "<E<Ssucceq"
  898.         "<Spreceq"
  899.         "<E<S!ネgg"
  900.         "<S!ヌll"
  901.         "<E<Ssupset"
  902.         "<Ssubset"
  903.         "<E<Ssupseteq"
  904.         "<Ssubseteq"
  905.         "<E<Ssqsupset"
  906.         "<Ssqsubset"
  907.         "<E<Ssqsupseteq"
  908.         "<Ssqsubseteq"
  909.         "<E<Sni"
  910.         "<Sin"
  911.         "<E<Sdashv"
  912.         "<Svdash"
  913.         "(-"
  914.         "equiv"
  915.         "sim"
  916.         "simeq"
  917.         "asymp"
  918.         "!ナapprox"
  919.         "cong"
  920.         "!ュneq"
  921.         "doteq"
  922.         "propto"
  923.         "(-"
  924.         "models"
  925.         "perp"
  926.         "mid"
  927.         "parallel"
  928.         "bowtie"
  929.         "join"
  930.         "smile"
  931.         "frown"
  932.         }
  933.     }
  934. }
  935.  
  936. proc relationsSubmenuFilter {submenu item} {
  937.     switch $item {
  938.         {join}  {set func "myJoin"}
  939.         default {set func $item}
  940.     }
  941.     eval $func
  942. }
  943.  
  944. # Return the "Arrows" submenu:
  945. proc arrowsSubmenu {} {
  946.     return {menu -M TeX -n Arrows -m {
  947.         "<SLeftarrow"
  948.         "<Sleftarrow"
  949.         "<E<SRightarrow"
  950.         "<Srightarrow"
  951.         "<E<SLeftrightarrow"
  952.         "<Sleftrightarrow"
  953.         "<E<SLongleftarrow"
  954.         "<Slongleftarrow"
  955.         "<E<SLongrightarrow"
  956.         "<Slongrightarrow"
  957.         "<E<SLongleftrightarrow"
  958.         "<Slongleftrightarrow"
  959.         "(-"
  960.         "<SUparrow"
  961.         "<Suparrow"
  962.         "<E<SDownarrow"
  963.         "<Sdownarrow"
  964.         "<E<SUpdownarrow"
  965.         "<Supdownarrow"
  966.         "(-"
  967.         "mapsto"
  968.         "longmapsto"
  969.         "leadsto"
  970.         "(-"
  971.         "leftharpoonup"
  972.         "rightharpoonup"
  973.         "leftharpoondown"
  974.         "rightharpoondown"
  975.         "rightleftharpoons"
  976.         "hookleftarrow"
  977.         "hookrightarrow"
  978.         "nearrow"
  979.         "searrow"
  980.         "swarrow"
  981.         "nwarrow"
  982.         }
  983.     }
  984. }
  985.  
  986. # Return the "Dots" submenu:
  987. proc dotsSubmenu {} {
  988.     return {menu -M TeX -n Dots -m {
  989.         "bullet"
  990.         "cdot"
  991.         "(-"
  992.         "ldots"
  993.         "cdots"
  994.         "vdots"
  995.         "ddots"
  996.         }
  997.     }
  998. }
  999.  
  1000. # Return the "Symbols" submenu:
  1001. proc symbolsSubmenu {} {
  1002.     return {menu -M TeX -n Symbols -m {
  1003.         "aleph"
  1004.         "hbar"
  1005.         "imath"
  1006.         "jmath"
  1007.         "ell"
  1008.         "wp"
  1009.         "Re"
  1010.         "Im"
  1011.         "mho"
  1012.         "(-"
  1013.         "angle"
  1014.         "backslash"
  1015.         "bot"
  1016.         "emptyset"
  1017.         "exists"
  1018.         "forall"
  1019.         "!ーinfty"
  1020.         "nabla"
  1021.         "!ツneg"
  1022.         "!カpartial"
  1023.         "prime"
  1024.         "!テsurd"
  1025.         "top"
  1026.         "(-"
  1027.         "Box"
  1028.         "Diamond"
  1029.         "triangle"
  1030.         "clubsuit"
  1031.         "diamondsuit"
  1032.         "heartsuit"
  1033.         "spadesuit"
  1034.         "(-"
  1035.         "flat"
  1036.         "natural"
  1037.         "sharp"
  1038.         }
  1039.     }
  1040. }
  1041.  
  1042. # Return the "Functions" submenu:
  1043. proc functionsSubmenu {} {
  1044.     return {menu -M TeX -n Functions -m {
  1045.         "arccos"
  1046.         "arcsin"
  1047.         "arctan"
  1048.         "arg"
  1049.         "cos"
  1050.         "cosh"
  1051.         "cot"
  1052.         "coth"
  1053.         "csc"
  1054.         "deg"
  1055.         "det"
  1056.         "dim"
  1057.         "exp"
  1058.         "gcd"
  1059.         "hom"
  1060.         "inf"
  1061.         "ker"
  1062.         "lg"
  1063.         "<B<O/Llim"
  1064.         "liminf"
  1065.         "limsup"
  1066.         "ln"
  1067.         "log"
  1068.         "max"
  1069.         "min"
  1070.         "Pr"
  1071.         "sec"
  1072.         "sin"
  1073.         "sinh"
  1074.         "sup"
  1075.         "tan"
  1076.         "tanh"
  1077.         "(-"
  1078.         "bmod"
  1079.         "pmod"
  1080.         }
  1081.     }
  1082. }
  1083.  
  1084. # Return the "Large Operators" submenu:
  1085. proc largeOperatorsSubmenu {} {
  1086.     return {menu -M TeX -n {Large Operators} -m {
  1087.         "<B<O/Ssum"
  1088.         "<B<O/Pprod"
  1089.         "coprod"
  1090.         "<B<O/Iint"
  1091.         "oint"
  1092.         "(-"
  1093.         "bigcup"
  1094.         "bigcap"
  1095.         "bigsqcup"
  1096.         "bigvee"
  1097.         "bigwedge"
  1098.         "bigodot"
  1099.         "bigotimes"
  1100.         "bigoplus"
  1101.         "biguplus"
  1102.         }
  1103.     }
  1104. }
  1105.  
  1106. # Return the "Delimiters" submenu:
  1107. proc delimitersSubmenu {} {
  1108.     return {menu -M TeX -n Delimiters -m -p delimitersSubmenuFilter {
  1109.         "parentheses"
  1110.         "brackets"
  1111.         "braces"
  1112.         {vertical bars}
  1113.         {other delimsノ}
  1114.         "(-"
  1115.         {half-open interval}
  1116.         {half-closed interval}
  1117.         "(-"
  1118.         {<Smulti-line big parentheses}
  1119.         {<Sbig parentheses}
  1120.         {<E<Smulti-line big brackets}
  1121.         {<Sbig brackets}
  1122.         {<E<Smulti-line big braces}
  1123.         {<Sbig braces}
  1124.         {<E<Smulti-line big vertical bars}
  1125.         {<Sbig vertical bars}
  1126.         {<E<Sother multi-line big delimsノ}
  1127.         {<Sother big delimsノ}
  1128.         "(-"
  1129.         {<Smulti-line big left brace}
  1130.         {<Sbig left brace}
  1131.         {<E<Sother multi-line mixed big delimsノ}
  1132.         {<Sother mixed big delimsノ}
  1133.         }
  1134.     }
  1135. }
  1136.  
  1137. proc delimitersSubmenuFilter {submenu item} {
  1138.     switch $item {
  1139.         {vertical bars}  {set func "absoluteValue"}
  1140.         {other delims}  {set func "otherDelims"}
  1141.         {half-open interval}  {set func "half-openInterval"}
  1142.         {half-closed interval}  {set func "half-closedInterval"}
  1143.         {big parentheses}  {set func "bigParens"}
  1144.         {multi-line big parentheses}  {set func "multiBigParens"}
  1145.         {big brackets}  {set func "bigBrackets"}
  1146.         {multi-line big brackets}  {set func "multiBigBrackets"}
  1147.         {big braces}  {set func "bigBraces"}
  1148.         {multi-line big braces}  {set func "multiBigBraces"}
  1149.         {big vertical bars}  {set func "bigAbsValue"}
  1150.         {multi-line big vertical bars}  {set func "multiBigAbsValue"}
  1151.         {other big delims}  {set func "otherBigDelims"}
  1152.         {other multi-line big delims}  {set func "otherMultiBigDelims"}
  1153.         {big left brace}  {set func "bigLeftBrace"}
  1154.         {multi-line big left brace}  {set func "multiBigLeftBrace"}
  1155.         {other mixed big delims}  {set func "otherMixedBigDelims"}
  1156.         {other multi-line mixed big delims}  {set func "otherMultiMixedBigDelims"}
  1157.         default {set func $item}
  1158.     }
  1159.     eval $func
  1160. }
  1161.  
  1162. # Return the "Math Accents" submenu:
  1163. proc mathAccentsSubmenu {} {
  1164.     return {menu -M TeX -n {Math Accents} -m {
  1165.         "<B<O/Aacute"
  1166.         "<B<O/Bbar"
  1167.         "breve"
  1168.         "<B<O/Ccheck"
  1169.         "<B<O/Ddot"
  1170.         "ddot"
  1171.         "<B<O/Ggrave"
  1172.         "<B<O/Hhat"
  1173.         "<B<O/Ttilde"
  1174.         "<B<O/Vvec"
  1175.         "(-"
  1176.         "widehat"
  1177.         "widetilde"
  1178.         "(-"
  1179.         "imath"
  1180.         "jmath"
  1181.         }
  1182.     }
  1183. }
  1184.  
  1185. # Return the "Grouping" submenu:
  1186. proc groupingSubmenu {} {
  1187.     return {menu -M TeX -n Grouping -m {
  1188.         "<B<O/Uunderline"
  1189.         "<B<O/Ooverline"
  1190.         "<B<I<O/Uunderbrace"
  1191.         "<B<I<O/Ooverbrace"
  1192.         "(-"
  1193.         "overrightarrow"
  1194.         "overleftarrow"
  1195.         "(-"
  1196.         "stackrel"
  1197.         }
  1198.     }
  1199. }
  1200.  
  1201. # Return the "Spacing" submenu:
  1202. proc spacingSubmenu {} {
  1203.     return {menu -M TeX -n Spacing -m -p spacingSubmenuFilter {
  1204.         {neg thin}
  1205.         "thin"
  1206.         "medium"
  1207.         "thick"
  1208.         "(-"
  1209.         "quad"
  1210.         "qquad"
  1211.         "(-"
  1212.         "hspace"
  1213.         "vspace"
  1214.         "(-"
  1215.         "hfill"
  1216.         "vfill"
  1217.         "(-"
  1218.         "smallskip"
  1219.         "medskip"
  1220.         "bigskip"
  1221.         }
  1222.     }
  1223. }
  1224.  
  1225. proc spacingSubmenuFilter {submenu item} {
  1226.     switch $item {
  1227.         {neg thin}  {set func "negThin"}
  1228.         default {set func $item}
  1229.     }
  1230.     eval $func
  1231. }
  1232.  
  1233.